package com.myj.jim.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.myj.jim.domain.bootstraptable.BootstrapTable;
import com.myj.jim.domain.bootstraptable.BootstrapTableJSON;

public class BootstrapTableUtil {
	public static BootstrapTableJSON<?> initBtj(List<?> list, int total){
		BootstrapTableJSON btj = new BootstrapTableJSON();
		btj.setRows(list);
		btj.setTotal(total);
		return btj;
	}
	
	public static Map<String ,Object> getParamMap(BootstrapTable bt){
		Map<String,Object> map = new HashMap<String,Object>();
		
		if(StringUtils.isNotBlank(bt.getField()) && StringUtils.isNotBlank(bt.getFieldVal())){
			map.put(bt.getField(), bt.getFieldVal());
		}
		map.put("offset", bt.getOffset());
		map.put("limit", bt.getLimit());
		return map;
	}
}
